package demiChat;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import common.BaseServlet;

/**
 * Servlet implementation class DemiChat
 */
public class DemiChat extends BaseServlet {
	private static final long serialVersionUID = 1L;
    
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DemiChat() {
        super();
        
        // TODO Auto-generated constructor stub
    }
    public void doAnyProc(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    	
    	request.setCharacterEncoding("utf-8");
    	
    	System.out.println("아오");
    	
    	chatMod.writeChat((String)request.getParameter("typingZone"), "demili", "1111");
    	ArrayList tempList;
    	
    	tempList=chatMod.getChatList();
    	
    	System.out.println(tempList);
    	
    	request.setAttribute("typeData", tempList);
    	
    	(request.getRequestDispatcher("/index.jsp")).forward(request, response);	
    }
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doAnyProc(request,response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doAnyProc(request,response);
	}

}
